<template>
	<view class="container">
		<view class="header">
			<image class="header_img" src="../../static/imgs/mine/sucess.png"></image>
			<view class="header-msg">
				<view class="header-msg_num">恭喜您，评分结果为<text class="text_active">{{details.remark}}的体能训练</text></view>
				<view class="header-msg_tips">我们已为您发放证书</view>
			</view>
		</view>
		<view class="rectangle">
			<image :src="details.cert"></image>
		</view>
		<view class="list">
			<view class="list-item">
				<view class="list-item-title">证书持有人</view>
				<view class="list-item-tips">{{details.name}}</view>
			</view>
			<view class="list-item">
				<view class="list-item-title">比赛阶段</view>
				<view class="list-item-tips">{{section_name}}</view>
			</view>
			<view class="list-item">
				<view class="list-item-title">认证机构</view>
				<view class="list-item-tips">奥北体能</view>
			</view>
			<view class="list-item">
				<view class="list-item-title">证书编号</view>
				<view class="list-item-tips">{{details.code}}</view>
			</view>
		</view>
		<view class="button" @click="getHonor" v-if="details.is_pay=='1'">我需要纸质证书和奖杯</view>
		<view class="button yellow" @click="getHonor" v-else>查看纸质证书/奖杯 “物流信息”</view>
	</view>
</template>

<script>
	import {getSportCertDetail} from "../../static/js/api/games.js";
	export default {
		data() {
			return {
				details: {},
				section_name:''

			}
		},
		onLoad(option) {
			if(option.code){
				this.getItem(option.code)
			}
			if(option.section_name){
				this.section_name = option.section_name
			}
		},
		methods: {
			getItem(code){
				getSportCertDetail({
					code:code
				}).then(res=>{
					console.log(res)
					this.details = res.cert
					this.details.price = res.price
				})
			},
			getHonor() {
				let params = {
					sport_id:this.details.sport_id,
					user_id:this.details.id,
					price:this.details.price
				}
				if(this.details.is_pay=='1'){
					uni.navigateTo({
						url:"/pages/mine/honorDetails?params="+JSON.stringify(params),
					})
				}else{
					uni.navigateTo({
						url:"/pages/mine/certPaid?params="+JSON.stringify(params),
					})
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	@import url("./index.scss");
	.yellow{
		background:#D19657!important;
	}
	.header {
		background: #ffffff;
		height: 112rpx;
		display: flex;
		align-items: center;
		margin-bottom: 0!important;
	}

	.header-msg_tips,
	.list-item-tips {
		color: $uni-text-color-opblack;
		line-height: 40rpx;

	}

	.header-msg_num,
	.list-item-title {
		color: $uni-text-color-black;

		text {
			color: #FF6E00;
		}
	}

	.header_img {
		width: 60rpx !important;
		height: 60rpx !important;
	}

	.header-msg_num {
		font-size: 24rpx;
		line-height: 34rpx;
		font-weight: bold;
	}

	.header-msg_tips {
		font-size: 24rpx;
		font-weight: 400;
	}

	.rectangle {
		background-color: #ffffff;
		display: flex;
		justify-content: center;

		image {
			width: 690rpx;
			height: 388rpx;
		}
	}

	.list-item {
		padding: 0 30rpx;
		width: calc(100% - 60rpx);
		height: 100rpx !important;
		margin-bottom: 2rpx;
	}

	.list-item[data-v-b7b58876]:nth-of-type(2) {
		margin-bottom: 2rpx !important;
	}

	.list-item-title {
		font-size: 32rpx;
		font-weight: 400;
	}

	.list-item-tips {
		font-size: 32rpx;
		font-weight: bold;
		color: #333;
	}

	.button {
		width: 690rpx;
		height: 88rpx;
		line-height: 88rpx;
		text-align: center;
		border-radius: 10rpx;
		margin: 30rpx auto;
		color: #ffffff;
		font-size: 32rpx;
		font-weight: bold;
		background-color: #FF6E00;
	}

	.footer-tips {
		text-align: center;
	}
	
	.certificate-box{
		padding: 14rpx 30rpx;
		width: calc(100% - 60rpx);
		background-color: #ffffff;
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 30rpx;
		image{
			width: 32rpx;
			height: 32rpx;
		}
		&-title{
			font-size: 24rpx;
			font-weight: bold;
			line-height: 34rpx;
		}
		&-tips{
			font-size: 24rpx;
			font-weight: 400;
			line-height: 40rpx;
		}
	}
</style>